@extends('layouts.admin')

@section('content')
    <!--面包屑导航 开始-->
    <div class="crumb_warp">
        <!--<i class="fa fa-bell"></i> 欢迎使用登陆网站后台，建站的首选工具。-->
        <i class="fa fa-home"></i> <a href="{{url('admin/index')}}">首页</a> &raquo; <a href="">编辑网站配置</a>
    </div>
    <!--面包屑导航 结束-->

	<!--结果集标题与导航组件 开始-->
	<div class="result_wrap">
        <div class="result_title">
            <h3>网站配置管理</h3>
        </div>
        <div class="result_content">
            <div class="short_wrap">
                <a href="{{url('admin/config/create')}}"><i class="fa fa-plus"></i>添加网站配置</a>
                <a href="{{url('admin/config')}}"><i class="fa fa-recycle"></i>全部网站配置</a>
            </div>
        </div>
    </div>
    <!--结果集标题与导航组件 结束-->
    @if(count($errors)>0)
        <div class="mark">
            @if(is_object($errors))
                @foreach($errors->all() as $key=>$error)
                    @if($key==0)
                        <script>layer.msg('{{$error}}', {icon: 5});</script>
                    @endif
                @endforeach
            @else
                <script>layer.msg('{{$errors}}', {icon: 5});</script>
            @endif
        </div>
    @endif
    <div class="result_wrap">
        <form action="{{url('admin/config/'.$conf_data->conf_id)}}" method="post">
            {{method_field('put')}}
            {{csrf_field()}}
            <table class="add_tab">
                <tbody>
                {{--<tr>--}}
                {{--<th width="120"><i class="require">*</i>父级分类：</th>--}}
                {{--<td>--}}
                {{--<select name="cate_pid">--}}
                {{--<option value="0">==顶级分类==</option>--}}
                {{--@foreach($cate_datas as $cd)--}}
                {{--<option value="{{$cd->cate_id}}">{{$cd->cate_name}}</option>--}}
                {{--@endforeach--}}

                {{--</select>--}}
                {{--</td>--}}
                {{--</tr>--}}

                <tr>
                    <th><i class="require">*</i>标题：</th>
                    <td>
                        <input type="text" name="conf_title" value="{{$conf_data->conf_title}}">

                        <span><i class="fa fa-exclamation-circle yellow"></i>网站配置标题必须填写</span>
                    </td>
                </tr>

                <tr>
                    <th><i class="require">*</i>名称：</th>
                    <td>
                        <input type="text" class="lg" name="conf_name" value="{{$conf_data->conf_name}}">
                        <span><i class="fa fa-exclamation-circle yellow"></i>配置项名称必须填写</span>
                    </td>
                </tr>

                <tr>
                    <th>类型：</th>
                    <td>
                        <input type="radio"  name="field_type" @if($conf_data->field_type=="input")checked @endif onclick="click_radio()" value="input">input &nbsp;&nbsp;
                        <input type="radio"  name="field_type" @if($conf_data->field_type=="textarea")checked @endif onclick="click_radio()" value="textarea">textarea &nbsp;&nbsp;
                        <input type="radio"  name="field_type" @if($conf_data->field_type=="radio")checked @endif onclick="click_radio()" value="radio">radio  &nbsp;

                    </td>
                </tr>
                <tr class="field_value">
                    <th>类型值：</th>
                    <td>
                        <input type="text" class="lg" name="field_value" value="{{$conf_data->field_value}}">
                        <span><i class="fa fa-exclamation-circle yellow"></i>只有在选中radio时有效</span>
                    </td>
                </tr>

                <tr>
                    <th>排序：</th>
                    <td>
                        <input type="text" name="conf_order" value="{{$conf_data->conf_order}}">

                    </td>
                </tr>
                <tr>
                    <th>说明：</th>
                    <td>
                        <textarea id="" cols="30" rows="10" name="conf_tips">{{$conf_data->conf_tips}}</textarea>

                    </td>
                </tr>
                <tr>
                    <th></th>
                    <td>
                        <input type="submit" value="提交">
                        <input type="button" class="back" onclick="history.go(-1)" value="返回">
                    </td>
                </tr>
                </tbody>
            </table>
        </form>
    </div>
    <script>
        click_radio();
        function click_radio(){
            var type = $("input[name=field_type]:checked").val();
            if(type=="radio"){
                $(".field_value").show();
            }else {
                $(".field_value").hide();
            }
        }

    </script>
@endsection
